<?

/********************************************
* teambadge_form.php
*
* This page displays a form to pass data to teambadge.php to generate a team badge.
*
********************************************/

//include files
include "../config.php";
include "../../lib/db.php";
include "../../lib/tbatv_lib.php";

$relpath = "../";
$title = " - Team Badge Generator";

include "../header.php";

//retrieve any form data:
$teamnumber = sanatizeGet($_REQUEST["teamnumber"]);
$start_color = str_replace("#", "", sanatizeGet($_REQUEST['startcolor']));
$stop_color = str_replace("#", "", sanatizeGet($_REQUEST['stopcolor']));
$debug = sanatizeGet($_REQUEST['debug']);
if ($debug == 1) $debugstring = "&debug=1";

?>
<h1>Team Badge Generator</h1>
<?

if($_GET["submit"] == "submit") {
?>
<h2>Your Badge</h2>

<center><img style="border: 2px solid white; padding: 6px;" src="http://www.thebluealliance.net/tbatv/teambadge/gen/<? echo $teamnumber ?>/<? echo $start_color ?>/<? echo $stop_color ?>/teambadge.png" alt="Team <?echo $teamnumber?>"/></center>

<p>Here are the code snippets to include your badge in your forum signature or website. Select a textbox and copy-paste the code! The image will link to your team's website on The Blue Alliance.</p>

<p><strong>Bulletin Board Code</strong></p>
<textarea rows="2" cols="40" onclick="this.focus();this.select()">[URL=http://www.thebluealliance.net/tbatv/team.php?team=<? echo $teamnumber ?>][IMG]http://www.thebluealliance.net/tbatv/teambadge/gen/<? echo $teamnumber ?>/<? echo $start_color ?>/<? echo $stop_color ?>/teambadge.png[/IMG][/URL]</textarea>
<br />
<p><strong>Website Code</strong></p>
<textarea rows="2" cols="40" onclick="this.focus();this.select()">&lt;a href=&quot;http://www.thebluealliance.net/tbatv/team.php?team=<? echo $teamnumber ?>&quot; style=&quot;border: 0&quot;&gt;&lt;img src=&quot;http://www.thebluealliance.net/tbatv/teambadge/gen/<? echo $teamnumber ?>/<? echo $start_color ?>/<? echo $stop_color ?>/teambadge.png&quot; alt=&quot;Team <?echo $teamnumber?>&quot; /&gt;&lt;/a&gt;</textarea>

<?
}

?>
<h2>Settings</h2>
<script src="../scripts/colorpicker.js" type="text/javascript"></script>
<div id="colorpicker301" class="colorpicker301"></div>
<p>The purpose of this page is to allow you to automatically generate team badges that you can include in your forum signature or on your website automatically, and with up-to-date team information! To get the code to include your team badge, just set your options below:</p>

<form method="get" action="teambadge.php">
<table class="form" style="margin: 0 auto;">
	<tr class="headerrow">
		<td><strong>Badge Settings:</strong></td>
	</tr>
	<tr>
		<td>Team Number:</td><td><input type='text' name='teamnumber' value='<? echo $teamnumber ?>' size="7" /></td>
	</tr>
	<tr>
		<td>Start Color:</td><td><input type='text' name='startcolor' id='startcolor' value='<? echo $start_color ?>' size="7" />&nbsp;<a href="javascript:showColorGrid3('startcolor','none');" style="font-size: .8em">(click here to pick color)<img src="../images/colorpicker.gif"/></a></td>
	</tr>
	<tr>
		<td>End Color:</td><td><input type='text' name='stopcolor' id='stopcolor' value='<? echo $stop_color ?>' size="7" />&nbsp;<a href="javascript:showColorGrid3('stopcolor','none');" style="font-size: .8em">(click here to pick color)<img src="../images/colorpicker.gif"/></a></td>
	</tr>
	</tr>
	<tr>
		<td><input type="submit" name="submit" value="submit"></td>
	</tr>
</table>
</form>
<?

include "../footer.php";
?>